using System;
using System.Windows.Forms;

using FreeFlow.Administration;

namespace FreeFlowAdministrator
{
	/// <summary>
	/// Summary description for SqlWindowAdaptor.
	/// </summary>
	public class SqlWindowAdaptor : Adaptor
	{
    private Server server;
		public SqlWindowAdaptor(Server server)
		{
      this.server = server;
		}

    public override string Text
    {
      get
      {
        return "SQL Window";
      }
    }

    private SqlWindowControl sqlWindow;
    public override Control GetRenderer()
    {
      if (sqlWindow == null)
        sqlWindow = new SqlWindowControl();
      sqlWindow.Server = server;
      return sqlWindow;
    }

    public override int ImageIndex
    {
      get
      {
        return 24;
      }
    }

    public override object Object
    {
      get
      {
        return server;
      }
    }

    public void ExecuteSql(string sql)
    {
      // make sure the control is created
      GetRenderer();
      sqlWindow.ExecuteSql(sql);
    }
	}
}
